#include "defines.h"
#include <cmath>

double hdmap_lane::getDir()
{
    if(geometry.empty())
        return -1.0;

	Eigen::Vector3d s = geometry[0];
	Eigen::Vector3d e = geometry[geometry.size() - 1];
	Eigen::Vector3d dir = e - s;
	dir = dir.normalized();
    double bearing = std::atan2(dir.y(), dir.x());
	return bearing;
}